dim app,doc,v
set app=application
set doc=app.activedocument
set v = doc.ActiveView
main
sub Main
	doc.SelectObjects ppcbObjectTypeAll, "*", true 	
	ColorSelectedNetClasses 0
end Sub

sub ColorSelectedNetClasses(selectColorIndex)		
	dim ncount
	dim objs
	set objs = doc.getobjects(2,,true)
	ncount = objs.count
		
	dim ostr
	ostr = "Application.ExecuteCommand(""View Nets"")" & chr(13) & chr(10)
	ostr = ostr & "ViewNetsDlg.SelectBy = ""Selected""" & chr(13) & chr(10)
	for i= 0 to ncount-1	
		ostr = ostr & "ViewNetsDlg.ViewList.Selected("& cint(i) &") = true" & chr(13) & chr(10)
		ostr = ostr & "ViewNetsDlg.ColorsButtonPad.SetActive ("& cint(selectColorIndex) &")" & chr(13) & chr(10)
	next			
	ostr = ostr & vbcrlf & "ViewNetsDlg.Ok.Click()"			
			
	dim tmpfile
	tmpfile = doc.path & "\tmp1.mcr"
	Dim fso,fw
	Set fso = CreateObject("scripting.filesystemobject")
	Set fw = fso.CreateTextFile(tmpfile,True)
	fw.Write ostr
	fw.close
	Set fw = Nothing	
	Set fso = Nothing			
	application.RunMacro(tmpfile,"")
end sub
